package sixteen;

public class DefineException {
    public static void main(String[] args) throws DivideDivideByMinusException {
        try {
            int result = divide(4,0);
            System.out.println(result);
        } catch (DivideDivideByMinusException e) {
            System.out.println(e.getMessage());
        }
    }
    public static int divide(int x,int y) throws DivideDivideByMinusException {
        if (y==0){
            throw new DivideDivideByMinusException("除数不合法");
        }
        return x/y;
    }
}
